<?php

use yii\helpers\Url;

echo $this->render('/layouts/header');
?>
<div style="margin:0px auto; margin-top:10px; width:1000px;">
  <ul>
    <li>接口名称：<?php echo $api["name"]?></li>
    <li>接口地址：<?php echo $api["uri"]?></li>
    <li>接口方法：<?php echo $api["method"]?></li>
  </ul>
</div>

<br>
<table align="center" width="1000" cellpadding="0" cellspacing="1" style="border:1px solid #CCC">
  <form id="requestform">
  <tr bgcolor="#EEE" height="24">
    <td width="120">参数名</td>
    <td width="400">参数</td>
    <td>必填</td>
    <td>类型</td>
    <td>说明</td>
  </tr>
<?php

if(isset($api["params"]) && count($api["params"])>0){

	foreach($api["params"] as $param){

		$value = is_array($param["default"]) ? json_encode($param["default"]) : $param["default"];
?>
  <tr bgcolor="#F9F9F9" height="24">
    <td><?php echo $param["name"]?></td>
<?php
		if(strtoupper($param["type"]) == "ENUM"){
		    echo '<td>';
            echo '<select id="" name="'. $param["name"].'">';
		    $options = $param["options"];
		    foreach ($options as $option){
		        echo '<option value="'.$option["value"].'">'.$option["name"].'</option>';
            }
            echo '</select>';
            echo '</td>';
		}else if(strtoupper($param["type"]) == "JSON"){
?>
    <td><textarea name="<?php echo $param["name"]?>" cols="50" rows="8"><?php echo $value;?></textarea></td>
<?php
		}else{
?>
	<td><input name="<?php echo $param["name"]?>" type="text" value='<?php echo $value?>'/></td>
<?php
		}
?>
    <td><?php echo $param["necessary"] ? '是' : '否';?></td>
    <td><?php echo $param["type"]?></td>
    <td><?php echo $param["intro"]?></td>
  </tr>
<?php
	}
}
?>

  </form>
</table>
<script language="javascript">


</script>
</body>
</html>